﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace School
{
    class Student
    {
        private string name;
        private int age;
        private string gender;
        private int classNumber;
        private int ssn;
        private DateTime dateOfBirth;

        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                if (value.Length >= 10 && value.Length <= 50)
                {
                    name = value;
                }
                else
                {
                    throw new InvalidStudentException("Invalid name, the name should be between 10 and 50 symbols!");
                }
            }

        }

        public int Age
        {
            get
            {
                return age;
            }
            set
            {
                if (value >= 7 && value <= 18)
                {
                    age = value;
                }
                else
                {
                    throw new InvalidStudentException("Invalid age, the age should be between 7 and 18!");
                }
            }

        }


        public string Gender
        {
            get
            {
                return gender;
            }
            set
            {
                if (value == "male" || value == "female")
                {
                    gender = value;
                }
                else
                {
                    throw new InvalidStudentException("Invalid gender, the gender should be male or female!");
                }
            }

        }

        public int ClassNumber
        {
            get
            {
                return classNumber;
            }
            set
            {
                if (value >=1 && value <=11)
                {
                    classNumber = value;
                }
                else
                {
                    throw new InvalidStudentException("Invalid classNumber, the class number should be between 1 and 11!");
                }
            }

        }

        public int Ssn
        {
            get
            {
                return ssn;
            }
            set
            {
                if (value >= 0 && value <= 999999999)
                {
                    ssn = value;
                }
                else
                {
                    throw new InvalidStudentException("Invalid ssn, it should be between 0 and 999999999!");
                }
            }

        }

        public DateTime DateOfBirth
        {
            get
            {
                return dateOfBirth;
            }
            set
            {
                if (value >=new DateTime(1990,1,1) && value <= new DateTime(2010,1,1))
                {
                    dateOfBirth = value;
                }
                else
                {
                    throw new InvalidStudentException("Invalid dateOfBirth, it should be between 01.01.1990 and 01.01.2010");
                }
            }

        }
        public Student( string name,int age, string gender, int classNumber, int ssn, DateTime dateOfBirth)
        {
            this.Name = name;
            this.Age = age;
            this.Gender = gender;
            this.ClassNumber = classNumber;
            this.Ssn = ssn;
            this.DateOfBirth = dateOfBirth;
        }
    }
}
